#include <iostream>
#include <cmath>
using namespace std;
int main() {
    ios_base::sync_with_stdio(0);cin.tie(NULL);
    cout << sizeof(long long);
    long long x0, y0, ax, ay, bx, by, xs, ys, t;
    cin >> x0 >> y0 >> ax >> ay >> bx >> by >> xs >> ys >> t;
    long long x = xs, y = ys;
    long long ans = 0;
    bool first = true;
    while(t){
        long long xn, yn;
        if(first){
            xn = x0, yn = y0;
            first = false;
        }
        else xn = x*ax+bx, yn = y*ay+by;

        t -= abs(xn-x) + abs(yn-y);
        if(t>=0) ans++;
        x = xn, y = yn;
    }
    cout << ans;
    return 0;
}
